package com.honey.mybatis.generator.criteria;

import com.honey.compilation.java.AbstractJavaCompilation;
import com.honey.compilation.java.Field;
import com.honey.compilation.java.InnerEnum;
import com.honey.compilation.java.Method;
import com.honey.core.compiler.CompilationException;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.mybatis.generator.AbstractProduceJavaCompilation;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.criteria.field.BetweenField;
import com.honey.mybatis.generator.criteria.field.CriteriaField;
import com.honey.mybatis.generator.criteria.field.EqualToField;
import com.honey.mybatis.generator.criteria.field.GreaterThanField;
import com.honey.mybatis.generator.criteria.field.GreaterThanOrEqualToThanField;
import com.honey.mybatis.generator.criteria.field.InField;
import com.honey.mybatis.generator.criteria.field.IsNotNullField;
import com.honey.mybatis.generator.criteria.field.IsNullField;
import com.honey.mybatis.generator.criteria.field.LessThanField;
import com.honey.mybatis.generator.criteria.field.LessThanOrEqualToField;
import com.honey.mybatis.generator.criteria.field.LikeField;
import com.honey.mybatis.generator.criteria.field.NotBetweenField;
import com.honey.mybatis.generator.criteria.field.NotEqualToField;
import com.honey.mybatis.generator.criteria.field.NotInField;
import com.honey.mybatis.generator.criteria.method.AddCriterion1Method;
import com.honey.mybatis.generator.criteria.method.AddCriterion2Method;
import com.honey.mybatis.generator.criteria.method.AddCriterion3Method;
import com.honey.mybatis.generator.criteria.method.AndBetweenMethod;
import com.honey.mybatis.generator.criteria.method.AndEqualToMethod;
import com.honey.mybatis.generator.criteria.method.AndGreaterThanMethod;
import com.honey.mybatis.generator.criteria.method.AndGreaterThanOrEqualToMethod;
import com.honey.mybatis.generator.criteria.method.AndInArrayMethod;
import com.honey.mybatis.generator.criteria.method.AndInMethod;
import com.honey.mybatis.generator.criteria.method.AndIsNotNullMethod;
import com.honey.mybatis.generator.criteria.method.AndIsNullMethod;
import com.honey.mybatis.generator.criteria.method.AndLessThanMethod;
import com.honey.mybatis.generator.criteria.method.AndLessThanOrEqualToMethod;
import com.honey.mybatis.generator.criteria.method.AndLikeMethod;
import com.honey.mybatis.generator.criteria.method.AndNotBetweenMethod;
import com.honey.mybatis.generator.criteria.method.AndNotEqualToMethod;
import com.honey.mybatis.generator.criteria.method.AndNotInArrayMethod;
import com.honey.mybatis.generator.criteria.method.AndNotInMethod;
import com.honey.mybatis.generator.criteria.method.AndNotLikeMethod;
import com.honey.mybatis.generator.criteria.method.ConstructorMethod;
import com.honey.mybatis.generator.criteria.method.GetAllCriteriaMethod;
import com.honey.mybatis.generator.criteria.method.GetCriteriaMethod;
import com.honey.mybatis.generator.criteria.method.IsValidMethod;

public class ProduceGeneratedCriteria extends AbstractProduceJavaCompilation {

	public ProduceGeneratedCriteria(MybatisPlugin mybatisPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(mybatisPlugin, introspectSchema, introspectSchemaColumn);
	}
	
	@Override
	public AbstractJavaCompilation produceCompilation()
			throws CompilationException {
		return new GeneratedCriteriaClass(
				mybatisPlugin,
				introspectSchema,
				introspectSchemaColumn
		).createJavaCompilation();
	}

	@Override
	public Field[] produceFields() throws CompilationException {
		Field[] answer = new Field[]{
			new CriteriaField().createField(),
//			new IsNullField().createField(),
//			new IsNotNullField().createField(),
//			new EqualToField().createField(),
//			new NotEqualToField().createField(),
//			new GreaterThanField().createField(),
//			new GreaterThanOrEqualToThanField().createField(),
//			new LessThanField().createField(),
//			new LessThanOrEqualToField().createField(),
//			new InField().createField(),
//			new NotInField().createField(),
//			new BetweenField().createField(),
//			new NotBetweenField().createField(),
//			new LikeField().createField(),
			
		};
		
		return answer;
	}

	@Override
	public Method[] produceMethods() throws CompilationException {
		Method[] answer = new Method[]{
				new ConstructorMethod().createMethod(),
				new IsValidMethod().createMethod(),
				new GetAllCriteriaMethod().createMethod(),
				new GetCriteriaMethod().createMethod(),
				new AndIsNullMethod().createMethod(),
				new AndIsNotNullMethod().createMethod(),
				new AndEqualToMethod().createMethod(),
				new AndNotEqualToMethod().createMethod(),
				new AndGreaterThanMethod().createMethod(),
				new AndGreaterThanOrEqualToMethod().createMethod(),
				new AndLessThanMethod().createMethod(),
				new AndLessThanOrEqualToMethod().createMethod(),
				new AndInMethod().createMethod(),
				new AndInArrayMethod().createMethod(),
				new AndNotInMethod().createMethod(),
				new AndNotInArrayMethod().createMethod(),
				new AndBetweenMethod().createMethod(),
				new AndNotBetweenMethod().createMethod(),
				new AndLikeMethod().createMethod(),
				new AndNotLikeMethod().createMethod(),
				new AddCriterion1Method().createMethod(),
				new AddCriterion2Method().createMethod(),
				new AddCriterion3Method().createMethod(),
		};
		return answer;
	}

	
	/* (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractProduceJavaCompilation#produceInnerEnumClass()
	 */
	@Override
	public InnerEnum[] produceInnerEnumClass() throws CompilationException {
		return new InnerEnum[] {
				(InnerEnum)(new TermClass().createJavaCompilation()),
		};
	}
	
}
